Skip to content

feat(tracing): Add option to exclude specific span origins #4463

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 8 commits into
base: potel-base
Choose a base branch
from

Conversation

sentrivana
Copy link
Contributor

@sentrivana sentrivana commented Jun 13, 2025

Allow to turn off span creation based on span origin.

Useful when you're double instrumenting a library with e.g. Sentry and OpenTelemetry and you want to turn off Sentry spans. (On the OTel side you can also disable specific instrumentation. By adding the possibility to do this on the Sentry side of things, we enable users to pick whichever they prefer.)

Caveats to consider before approving this:

  • Any child spans of ignored spans will be promoted to transactions unless they have only_if_parent=True. (This will need to be documented in the docs.)
  • It can be (mis)used for filtering out any kind of spans outside of any dual OTel/Sentry scenario, basically as a workaround for the missing ignore_spans option that's been requested over and over again.
  • Span creation can also be turned off by simply disabling an integration. However, that also disables error capturing and anything else the integration does on top.

Copy link

codecov bot commented Jun 13, 2025

Codecov Report

Attention: Patch coverage is 84.61538% with 2 lines in your changes missing coverage. Please review.

Project coverage is 84.83%. Comparing base (06ef70c) to head (f5f1e0f).

✅ All tests successful. No failed tests found.

Files with missing lines Patch % Lines
sentry_sdk/tracing_utils.py 75.00% 1 Missing and 1 partial ⚠️
Additional details and impacted files
@@              Coverage Diff               @@
##           potel-base    #4463      +/-   ##
==============================================
- Coverage       84.84%   84.83%   -0.02%     
==============================================
  Files             144      144              
  Lines           14882    14893      +11     
  Branches         2362     2365       +3     
==============================================
+ Hits            12627    12634       +7     
- Misses           1533     1535       +2     
- Partials          722      724       +2     
Files with missing lines Coverage Δ
sentry_sdk/consts.py 99.66% <ø> (ø)
sentry_sdk/tracing.py 80.55% <100.00%> (+0.20%) ⬆️
sentry_sdk/tracing_utils.py 84.65% <75.00%> (-0.19%) ⬇️

... and 3 files with indirect coverage changes

@sentrivana sentrivana changed the title feat(tracing): Add option to disable specific span origins feat(tracing): Add option to exclude specific span origins Jun 16, 2025
@sentrivana sentrivana marked this pull request as ready for review June 16, 2025 11:41
@sentrivana sentrivana requested a review from a team as a code owner June 16, 2025 11:41
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant